#!/usr/bin/python3
# -*- coding:utf-8 -*-

from urllib.request import urlopen
from bs4 import BeautifulSoup


url=""

def translate_english_to_chinese(key):
    url = "https://cn.bing.com/dict/search?q="+key
    print(url)
    url_response = urlopen(url)
    bs = BeautifulSoup(url_response, "html.parser")
    words_list = bs.select("div > h1 > strong")
    for words in words_list:
        print(words.text)

    explains_list_temp = bs.select("div.qdef")
    # print(explains_list_temp)
    explains_list = []
    for explains in explains_list_temp:
        lis_list_temp = explains.select("li")
        lis_list = []
        for li in lis_list_temp:
            lis_list.append(li.text)
        explains_list.append(lis_list)
        print(explains_list)




translate_english_to_chinese("book")